<?php

namespace App\Remote\XiaoHongShu;

use App\Exceptions\BaseException;
use GuzzleHttp\Exception\GuzzleException;
use Symfony\Component\HttpFoundation\Request as RequestAlias;

class XhsShopRemote extends XhsBusinessBaseRemote
{
    /**
     * 门店列表
     *
     * @return mixed
     * @throws BaseException
     * @throws GuzzleException
     */
    public static function getShopList()
    {
        return self::customRequestV3(
            "api/locallife/getPoiList",
            RequestAlias::METHOD_GET
        )["data"];
    }

    /**
     * 获取门店详情
     *
     * @param string $poiId
     * @return mixed
     * @throws BaseException
     * @throws GuzzleException
     */
    public static function getShopDetail(string $poiId)
    {
        return self::customRequestV3(
            "api/locallife/poiInfo",
            RequestAlias::METHOD_POST,
            ["poi_id" => $poiId]
        )["data"];
    }

    /**
     * 模糊查询门店列表
     *
     * @param string $poiName
     * @param string $poiId
     * @return mixed
     * @throws BaseException
     * @throws GuzzleException
     */
    public static function searchShop(string $poiName, string $poiId = "")
    {
        return self::customRequestV3(
            "api/locallife/searchStore",
            RequestAlias::METHOD_POST,
            [
                "poi_id"   => $poiId,
                "poi_name" => $poiName
            ]
        )["data"];
    }

}
